<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Ajax和跨域</title>
  </head>
  <body>
    <button id="btn">发送请求</button>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.js"></script>
    <script>
      function success(data) {
        console.log(data);
      }
    </script>
    <script>
      $("#btn").click(function () {
        var script = document.createElement("script");
        script.src = "http://127.0.0.1:3000/api/jsonp?callback=success";
        document.body.appendChild(script);
      });
    </script>
    <!-- <script src="http://127.0.0.1:3000/api/jsonp?callback=success"></script> -->
    <!-- E:\010.问题解决方案-代码仓库-COPY-LIB\1.前后端数据请求\Ajax和跨域-->
  </body>
</html>
